export function MP() {
    return new Promise((resolve, reject) => {
        // 如果已加载直接返回
        /* global BMap*/
        if(typeof BMap !== "undefined"){
            resolve(BMap);
            return true;
        }
        // 百度地图异步加载回调处理
        window.onBMapCallback = function() {
            resolve(BMap);
        };

        let script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://api.map.baidu.com/api?v=3.0&ak=YQsNGGNChGPm2gvLM7sINYfLyrowm9dK&s=1&callback=onBMapCallback";
        script.onerror = reject;
        document.head.appendChild(script);
    })
}
